package collection.utils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class CollectionsDemo {

	public static void main(String[] args) {

		List<Student> list = new ArrayList<Student>();
		list.add(new Student("382", "Aang"));
		list.add(new Student("125", "Beng"));
		list.add(new Student("226", "Cong"));
		Collections.sort(list);
		printCollection(list);

		Collections.sort(list, new StudentComparatorById());
		printCollection(list);
	}

	private static void printCollection(Collection<Student> c) {
		for (Student o : c) {
			System.out.println(o.toString());
		}
		System.out.println();
	}

}
